package com.xsoft.demo12.activity;

import android.os.Bundle;

import com.xsoft.demo12.R;
import com.xsoft.demo12.db.GoodDataBaseHelper;
import com.xsoft.demo12.fragment.GoodsListAdapter;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class CollectionActivity extends AppCompatActivity {
    private RecyclerView recyclerView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collection);
        recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
        recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
        GoodsListAdapter adapter = new GoodsListAdapter();
        adapter.bindData(new GoodDataBaseHelper(this).queryCollection());
        recyclerView.setAdapter(adapter);
    }
}
